package com.mine.common.core.utils.datetime;

import java.time.LocalDateTime;

/**
 * @author jalasmart
 * 2023/12/4 17:19
 */
public enum DateTimes {
    YEAR {
        @Override
        public LocalDateTime firstDateTime(LocalDateTime dateTime) {
            return Dates.firstDateTime(DateTimeType.YEAR, dateTime);
        }

        @Override
        public LocalDateTime lastDateTime(LocalDateTime dateTime) {
            return Dates.lastDateTime(DateTimeType.YEAR, dateTime);
        }
    }, MONTH {
        @Override
        public LocalDateTime firstDateTime(LocalDateTime dateTime) {
            return Dates.firstDateTime(DateTimeType.MONTH, dateTime);
        }

        @Override
        public LocalDateTime lastDateTime(LocalDateTime dateTime) {
            return Dates.lastDateTime(DateTimeType.MONTH, dateTime);
        }
    }, WEEK {
        @Override
        public LocalDateTime firstDateTime(LocalDateTime dateTime) {
            return Dates.firstDateTime(DateTimeType.WEEK, dateTime);
        }

        @Override
        public LocalDateTime lastDateTime(LocalDateTime dateTime) {
            return Dates.lastDateTime(DateTimeType.WEEK, dateTime);
        }
    }, DAY {
        @Override
        public LocalDateTime firstDateTime(LocalDateTime dateTime) {
            return Dates.firstDateTime(DateTimeType.DAY, dateTime);
        }

        @Override
        public LocalDateTime lastDateTime(LocalDateTime dateTime) {
            return Dates.lastDateTime(DateTimeType.DAY, dateTime);
        }
    }, HOUR {
        @Override
        public LocalDateTime firstDateTime(LocalDateTime dateTime) {
            return Dates.firstDateTime(DateTimeType.HOUR, dateTime);
        }

        @Override
        public LocalDateTime lastDateTime(LocalDateTime dateTime) {
            return Dates.lastDateTime(DateTimeType.HOUR, dateTime);
        }
    }, MINUTE {
        @Override
        public LocalDateTime firstDateTime(LocalDateTime dateTime) {
            return Dates.firstDateTime(DateTimeType.MINUTE, dateTime);
        }

        @Override
        public LocalDateTime lastDateTime(LocalDateTime dateTime) {
            return Dates.lastDateTime(DateTimeType.MINUTE, dateTime);
        }
    }, SECOND {
        @Override
        public LocalDateTime firstDateTime(LocalDateTime dateTime) {
            return Dates.firstDateTime(DateTimeType.SECOND, dateTime);
        }

        @Override
        public LocalDateTime lastDateTime(LocalDateTime dateTime) {
            return Dates.lastDateTime(DateTimeType.SECOND, dateTime);
        }
    };

    public abstract LocalDateTime firstDateTime(LocalDateTime dateTime);

    public abstract LocalDateTime lastDateTime(LocalDateTime dateTime);

}
